package my.mybatis.common.exception;

/**
 * @Author:wangbin.
 * @Description.
 * @Date:Created in 9:29 2018/1/16.
 * @Modified By:
 */
public enum ErrorCode{
    SUCCESS 			     		 		        ("2000000","操作成功"),
    POI_CELL_FORMAT_ERROR						    ("1111110","POI Cell 格式错误"),
    DATA_CHECK_ERROR                                ("1111111","数据校验失败！");

    private String code ;
    private String title;
    ErrorCode(String code, String title) {
        this.code = code;
        this.title = title;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public static String getNameByCode(String code){
        ErrorCode[] enums = ErrorCode.values();
        for(ErrorCode enu:enums){
            if(code.endsWith(enu.getCode()))
                return enu.getTitle();
        }
        return "";
    }
}
